package com.wc.codeforces.排序.Update_Queries;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/7/1 4:38
 * @description https://codeforces.com/problemset/problem/1986/C
 */
public class Main {
    /**
     * 思路：
     * 题有点坑，需要优化两个排序,就离谱
     * 用第一个的最前面的代替就好了, 其他的使用最原始的覆盖
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 100010, M = 30;
    static char[] s, t;
    static int[] id = new int[N], leNums = new int[M], idNums = new int[N];
    static int n, m;

    public static void main(String[] args) {
        int T = sc.nextInt();
        while (T-- > 0) {
            n = sc.nextInt();
            m = sc.nextInt();
            s = (" " + sc.next()).toCharArray();
            for (int i = 1; i <= m; i++) id[i] = sc.nextInt();
            t = (" " + sc.next()).toCharArray();
            Arrays.fill(leNums, 0);
            Arrays.fill(idNums, 1, n + 1, 0);
            for (int i = 1; i <= m; i++) {
                leNums[t[i] - 'a']++;
            }
            for (int i = 1; i <= m; i++) {
                idNums[id[i]]++;
            }
            for (int i = 1, j = 0; i <= n; i++) {
                if (idNums[i] != 0) {
                    while (leNums[j] == 0 && j < M) j++;
                    leNums[j]--;
                    s[i] = (char) (j + 'a');
                }
            }
            for (int i = 1; i <= n; i++) out.print(s[i]);
            out.println();
        }
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
